# # 匿名函数 = lambda 形参：表达式
# s = lambda a,b:a+b
# print(type(s))
# print(s(10,20))

lst = [10, 20, 30, 40, 50]
for i in range(len(lst)):
    print(lst[i])
print()

# 使用匿名函数取值
for i in range(len(lst)):
    result_1 = lambda x: x[i]
    print(result_1(lst))

score = [
    {'name': '张三', 'score': 99},
    {'name': '李四', 'score': 85},
    {'name': '王二', 'score': 66},
    {'name': '小红', 'score': 78},
]

score.sort(key=lambda x: x.get('score'), reverse=True)
print(score)

result_2 = lambda x: 10 * x
print(result_2(3))
print(result_2(2))
print(result_2(1))
